package cn.com.ebidding;

import cn.com.ebidding.utils.JSONUtils;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Date;

/**
 * @author qinchen
 * @date 2021/7/15 11:19
 * @description TODO
 */
public class App {

    public static void main(String[] args) {
        System.out.println("ok");
        try {
            Connection connection = DriverManager.getConnection("jdbc:mysql://192.168.2.8:3306/stdv6_fastdev?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC", "root", "123456");
            Statement statement = connection.createStatement();
            ResultSet rs = statement.executeQuery("select * from base_menu");
            // 展开结果集数据库
            while(rs.next()){
                // 通过字段检索
                long id  = rs.getLong("id");
                String name = rs.getString("menu_cname");

                // 输出数据
                System.out.print("ID: " + id);
                System.out.print(", 菜单名称: " + name);
                System.out.print("\n");
            }
            // 完成后关闭
            rs.close();
            statement.close();
            connection.close();
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }

        String date = JSONUtils.toString(new Date());

        System.out.println(date);

    }

}
